package org.emergency.framework.serviceImpl.oa.help;

import javax.annotation.Resource;

import org.emergency.framework.dao.oa.ITbUserDAO;
import org.emergency.framework.model.TbUser;
import org.springframework.stereotype.Repository;

@Repository("checkUserServiceImpl")
public class CheckUserServiceImpl {

	@Resource(name = "tbUserDAO")
	private ITbUserDAO tbUserDAO;
	
	public boolean checkUser(String name, String password) {
		//得到tbUser
		TbUser tbUser =null;
		try {
//			tbUser = (TbUser) tbUserDAO.
//				findListByCmd("from TbUser t where t.tbUserId = ?", -1, 1,
//					name).
//					get(0);
			tbUser = tbUserDAO.getHibernateTemplate().get(TbUser.class, name);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;		//查询出问题了，返回
		}
		if(tbUser==null){		//没有这个用户 ，用户密码不匹配时（还没做）
			return false;
		}
		return true;			
	}
}
